using UnityEngine;
using System.Collections;

public class destroy : MonoBehaviour {
	
	public GameObject pum;
	public GameObject showscore;

	void OnCollisionEnter2D(Collision2D c)
	{
		int f=(int)(c.relativeVelocity.magnitude);
		if(f>=1 && c.gameObject.tag=="Player")
		{
			rigidbody2D.gravityScale=1f;
			
			//for(int i=0;i<=f;i++)
			{
				GameObject clone;
				clone=Instantiate(pum,transform.position,transform.rotation) as GameObject;
				Destroy(clone,3f);
			}
			
			Destroy (gameObject);
			
			
			if(showscore!=null)
			{
				GameObject clone2;
				clone2=Instantiate(showscore,transform.position,transform.rotation) as GameObject;
				Destroy(clone2,3f);
			}
		}
	}
}
